package com.insta.playdroid;

import java.util.ArrayList;
import java.util.List;

import adapteurMediaStore.AdapteurPlaylistMediaStore;
import adapteurMediaStore.IAdapteurMediaStore;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ListView;

import com.insta.adapterList.PlaylistAdapter;
import com.insta.playdroid.metier.domain.Playlist;

public class PlayListActivity extends Activity {

	List<Playlist> playlists = new ArrayList<Playlist>();
	private IAdapteurMediaStore<Playlist> adapteurMediaStore;

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {

		super.onCreate(savedInstanceState);

		setContentView(R.layout.playlist);

		// charger playlists
		adapteurMediaStore = new AdapteurPlaylistMediaStore(getBaseContext());
		playlists = adapteurMediaStore.collectAllValuesFromDB();

		// charger les items
		ListView lv = (ListView) findViewById(android.R.id.list);
		lv.setTextFilterEnabled(true);

		PlaylistAdapter adapter = new PlaylistAdapter(this, playlists);
		lv.setAdapter(adapter);
		adapter.notifyDataSetChanged();
	}

	public void onNewPlaylistClick() {

	}
}
